//
#ifndef SERVICE_SHARED_MYSQL_SAVE_H
#define SERVICE_SHARED_MYSQL_SAVE_H

#include <nel/misc/thread.h>

namespace MSH
{

class SaveThread : public NLMISC::IRunnable
{
public:
	volatile bool  _run;

private:
	void run ();
};

class CMysqlSave
{
private:

	uint32              _poolSize;
	NLMISC::IThread     *_thread;
	SaveThread			_saveThread;
public:

	bool init( const std::string &hostName, const std::string &userName, const std::string &password, const std::string &defaultDatabase);
	bool push( char* sql );
	bool terminate()
	{
		_saveThread._run = false;
		_thread->wait ();
		return true;
	}
};

}
#endif // SERVICE_SHARED_MYSQL_SAVE_H
